<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>&amp;amp;</title>
</head>
<body>
<textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
<input type="submit" name="button" id="button" onclick="check();" value="提交" />
<script type="text/javascript">
var textarea = document.getElementById("textarea");

window.onload=function(){
	textarea.value = 'you & &a me';
}
function check() {
	var str = textarea.value;
	//replace & to &amp;
	str = str.replace(/&(?!amp;)/ig, '&amp;'); 
	
	textarea.value = str;
}
</script>
</body>
</html>
